<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.List" %>
<%@page import="java.util.Map" %>
<%@page import="java.util.Iterator" %>
<%@page import="java.text.SimpleDateFormat" %>

<div class="nom"><span>Comentaris:</span></div>
<% if((Boolean)session.getAttribute("isLogged")) { %>
<div class="intro">
    <textarea id="comment"></textarea>
    <div id="send" class="boto"> Envia </div>
    <hr />
</div>
<% } else { %>
<div class="intro">
    <div class="noCom">Per a introduir comentaris s'ha d'estar logejat</div>
    <hr />
</div>
<% } %>
<% List<Map<String, Object>> rs2 = (List<Map<String, Object>>) request.getAttribute("comentaris");
   Iterator<Map<String,Object>> it = rs2.iterator();
   Map<String,Object> id;
   //SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss");
if (!rs2.isEmpty()) {
    while(it.hasNext()) {
        id = it.next();%>
        <div class="text_comment">
            <div class="dades">
                <div class="nomU"><%=id.get("nom")%> <%=id.get("cognoms")%></div>
                <div class="hora"><%=id.get("data") %></div>
            </div>
            <div class="comm"> <%=id.get("comentari")%> </div>
        </div>
    <% } %>
<% } else { %>
    <div class="noCom">No hi ha comentaris</div>
<% } %>
